package ru.amse.jsynchro.net;

import java.io.Serializable;

public class Command implements Serializable {
    private static final long serialVersionUID = -8884904332968367652L;
    public static final int GET_TREE_ROOT = 1;
    public static final int GET_TREE = 2;
    public static final int END = 3;
    public static final int GET_FILE = 4;
    public static final int WRITE_FILE = 5;
    public static final int LIST_FILES = 6;
    public static final int DELETE_FILE = 7;
    public static final int GET_FILE_LENGTH = 8;
    public static final int MAKE_DIRECTORY = 9;
    public static final int CLOSE_INPUT_STREAM = 10;
    public static final int CLOSE_OUTPUT_STREAM = 11;
    public static final int GET_OUTPUT_STREAM = 12;
    public static final int IS_DIRECTORY = 13;
    public static final int ATTR_READ = 14;
    public static final int ATTR_WRITE = 15;
    public static final int ATTR_EXECUTE = 16;
    public static final int ATTR_HIDDEN = 17;
    public static final int ATTR_READONLY = 18;
    private int type;
    
    public Command(int type) {
        this.type = type;
    }
    
    public int getType() {
        return type;
    }
    
    public String toString() {
        switch (type) {
        case GET_TREE_ROOT: return "GET_TREE_ROOT";
        case GET_TREE: return "GET_TREE";
        case END: return "END";
        case GET_FILE: return "GET_FILE";
        case WRITE_FILE: return "WRITE_FILE";
        case LIST_FILES: return "LIST_FILES";
        case DELETE_FILE: return "DELETE_FILE";
        case GET_FILE_LENGTH: return "GET_FILE_LENGTH";
        case MAKE_DIRECTORY: return "MAKE_DIRECTORY";
        case CLOSE_INPUT_STREAM: return "CLOSE_INPUT_STREAM";
        case CLOSE_OUTPUT_STREAM: return "CLOSE_OUTPUT_STREAM";
        case GET_OUTPUT_STREAM: return "GET_OUTPUT_STREAM";
        case ATTR_READ: return "ATTR_READ";
        case IS_DIRECTORY: return "IS_DIRECTORY";
        case ATTR_WRITE: return "ATTR_WRITE";
        case ATTR_HIDDEN: return "ATTR_HIDDEN";
        case ATTR_EXECUTE: return "ATTR_EXECUTE";
//        case ATTR_READONLY: return "ATTR_READONLY";
        } 
        return "No type";
    }
    
}
